//
//  videoPlayBaseViewController.m
//  iphoneLive
//
//  Created by 志刚杨 on 2017/10/18.
//  Copyright © 2017年 cat. All rights reserved.
//

#import "videoPlayBaseViewController.h"
#import <YYKit/YYKit.h>
@interface videoPlayBaseViewController ()/**<>*/
//{
//    UIView *                        _videoPreview;
//    UIButton *                      _btnStartPreview;
//    UILabel*                        _progressTipLabel;
//    UISlider *                      _sdPreviewSlider;
//
//    int                             _recordType;
////    UIImage *                       _coverImage;
//    BOOL                            _previewing;
//    BOOL                            _startPlay;
//
//    BOOL                            _navigationBarHidden;
//    BOOL                            _statusBarHidden;
//    BOOL                            _isFromRecord;
//
////    NSString*                       _videoPath;
//    TX_Enum_Type_RenderMode         _renderMode;
//}
@end

@implementation videoPlayBaseViewController
//
//- (void)viewDidLoad {
//    [super viewDidLoad];
//    self.view.backgroundColor = [UIColor whiteColor];
//    [self initPreviewUI];
//
//    _livePlayer = [[TXLivePlayer alloc] init];
//    _livePlayer.delegate = self;
//
////    [self startVideoPreview:YES];
//    // Do any additional setup after loading the view.
//}
//
//-(void)viewWillAppear:(BOOL)animated
//{
////    _previewing = YES;
////    if (_previewing)
////    {
////        [self startVideoPreview:YES];
////    }
//}
//
//-(void)viewDidDisappear:(BOOL)animated
//{
//    [super viewDidDisappear:animated];
//    [self.livePlayer stopPlay];
//}
//- (void)didReceiveMemoryWarning {
//    [super didReceiveMemoryWarning];
//    // Dispose of any resources that can be recreated.
//}
//
//- (void)onAppDidEnterBackGround:(UIApplication*)app
//{
//    [self stopVideoPreview:NO];
//}
//
//- (void)onAppWillEnterForeground:(UIApplication*)app
//{
//    if (_previewing)
//    {
//        [self startVideoPreview:NO];
//    }
//}
//
-(void)startVideoPreview:(BOOL) startPlay
{
    [super startVideoPreview:startPlay];
//    if(startPlay == YES){
//        [_livePlayer setupVideoWidget:CGRectZero containView:_videoPreview insertIndex:0];
//        [_livePlayer startPlay:self.videoinfo.video_url type:PLAY_TYPE_VOD_MP4];
//        [_livePlayer setRenderMode:_renderMode];
//    }else{
//        [_livePlayer resume];
//    }
}
//
-(void)stopVideoPreview:(BOOL) stopPlay
{

    [super stopVideoPreview:stopPlay];
//    if(stopPlay == YES)
//        [_livePlayer stopPlay];
//    else
//        [_livePlayer pause];

}
//
//#pragma mark ---- Video Preview ----
//-(void)initPreviewUI
//{
//    //[_livePlayer setRenderMode:RENDER_MODE_FILL_EDGE];
//
//
//    UIImageView * coverImageView = [[UIImageView alloc] initWithFrame:self.view.frame];
//    coverImageView.backgroundColor = UIColor.blackColor;
//    if(_renderMode == RENDER_MODE_FILL_EDGE){
//        coverImageView.contentMode = UIViewContentModeScaleAspectFit;
//    }else{
//        coverImageView.contentMode = UIViewContentModeScaleAspectFill;
//    }
//    [coverImageView setImageURL:[NSURL URLWithString:self.model.img]];
//    [self.view addSubview:coverImageView];
//
//    _videoPreview = [[UIView alloc] initWithFrame:self.view.frame];
//    [self.view addSubview: _videoPreview];
//}
//
//-(void)onBtnPopBack
//{
//    [self dismissViewControllerAnimated:YES completion:^{
//    }];
//    //    [self.navigationController popViewControllerAnimated:YES];
//}
//
//-(void)onBtnPreviewStartClicked
//{
//    if (!_startPlay) {
//        [self startVideoPreview:YES];
//        _startPlay = YES;
//    }
//    _previewing = !_previewing;
//
//    if (_previewing)
//    {
//        [self startVideoPreview:NO];
//        [_btnStartPreview setImage:[UIImage imageNamed:@"pausepreview"] forState:UIControlStateNormal];
//        [_btnStartPreview setImage:[UIImage imageNamed:@"pausepreview_press"] forState:UIControlStateSelected];
//    }
//    else
//    {
//        [self stopVideoPreview:NO];
//        [_btnStartPreview setImage:[UIImage imageNamed:@"startpreview"] forState:UIControlStateNormal];
//        [_btnStartPreview setImage:[UIImage imageNamed:@"startpreview_press"] forState:UIControlStateSelected];
//    }
//}
//
//#pragma mark - TXLivePlayListener
//-(void) onPlayEvent:(int)EvtID withParam:(NSDictionary*)param
//{
//    NSDictionary* dict = param;
//    dispatch_async(dispatch_get_main_queue(), ^{
//        if (EvtID == PLAY_EVT_PLAY_PROGRESS) {
//            float progress = [dict[EVT_PLAY_PROGRESS] floatValue];
//            [_sdPreviewSlider setValue:progress];
//
//            float duration = [dict[EVT_PLAY_DURATION] floatValue];
//            if (duration > 0 && _sdPreviewSlider.maximumValue != duration) {
//                _sdPreviewSlider.minimumValue = 0;
//                _sdPreviewSlider.maximumValue = duration;
//            }
//            NSString* progressTips = [NSString stringWithFormat:@"%02d:%02d/%02d:%02d", (int)progress / 60, (int)progress % 60, (int)duration / 60, (int)duration % 60];
//            _progressTipLabel.text = progressTips;
//            return ;
//        } else if(EvtID == PLAY_EVT_PLAY_END) {
//            [_livePlayer stopPlay];
//            [_livePlayer resume];
//
////            [_sdPreviewSlider setValue:0];
//            //           [self stopVideoPreview:YES];
//            //           [self startVideoPreview:YES];
//            //           [_livePlayer startPlay:_videoPath type:PLAY_TYPE_LOCAL_VIDEO];
//
//            //[_livePlayer startPlay:_videoPath type:PLAY_TYPE_LOCAL_VIDEO];
////            _progressTipLabel.text = @"00:00/00:00";
//        }
//    });
//}
//
//-(void) onNetStatus:(NSDictionary*) param
//{
//    return;
//}




@end
